1. Field of the Invention
The present invention relates to an image processing method used for compressing a color document image, and an image processing apparatus.
2. Description of the Related Art
In recent years, along with the popularization of computerized information, systems that do not store paper documents are becoming popular. Such systems store documents electronically after computerizing them. For example, a scanner scans a paper document and transmits the obtained electronic data to other apparatuses. In order to reduce the amount of data transmitted, there has been a demand for compressing the electronic documents with higher compressibility. It is also important that the electronic data is capable of being partially edited and reused, and further has high image quality that is not easily deteriorated even if the document is enlarged or reduced.
However, in a case when a document image includes a text region as well as a photo region, if compression that is appropriate for the text region is performed, then an image of good quality but with low compression rate is obtained. On the other hand, if compression that is appropriate for the photo region is performed, then an image of high compression rate but with deteriorated characteristics is obtained. Thus, there is proposed a technique by which the electronic document image is divided into a text region and a photo region, and then the data of each region is converted by a different method.
For example, Japanese Patent Application Laid-Open No. 2004-265384 discusses a technique for generating a high-image-quality document image that is reusable and can be compressed at a high compression. According to this technique, a text region is converted into vector data since reusability and image quality is important to the text region. Regions other than the text region, such as a photo region, are not appropriately reproduced when they are vectorized. Such regions are thus compressed using JPEG compression. Accordingly, the vector data and the compressed data obtained from each region are synthesized and a high-image-quality document image that is reusable and that can be compressed at a high compression rate is obtained.
Further, Japanese patent No. 3376129 discusses a technique used for dividing an image into a text region (two-color region) and a natural image region (multicolor region), clipping each of the divided regions, filling the clipped regions in the image with substitute pixel data, and then performing binary coding of the clipped text region and multivalue coding of the clipped natural image region, respectively. In filling the clipped region with substitute pixel data, a mean value of pixels near the clipped region or pixel values of the pixels immediately before the clipped region in the scanning order are used.
By filling the clipped region, negative effects to image quality can be reduced. Additionally, coding efficiency of the filling-completed background portion can be improved.
A document file including a compressed background image and a partial image that are obtained according to the above-described technique will now be described. The compressed background image is obtained by clipping a partial region, such as a photo region or a text region, from an original image being a background image and filling the clipped partial region with pixels whose pixel values are mean values of the pixels that neighbor the clipped region.
When such a document file is displayed on a screen of a computer, in some cases a framing boundary streak of a color different from the colors of the pixels adjacent to the clipped region or pixels in the clipped partial region is observed. The boundary is formed by the image of the partial region displayed over the background image. Further, even if the image is not edited, if the display magnification is changed, a boundary streak formed by inconsistent colors may appear.
The framing boundary streak on the boundary may become thicker or thinner regardless of the magnification. This is considered to occur if the display magnification of the document file is changed and when the image of the partial region and the background image are enlarged or reduced separately and then the image of the partial region is superposed on the background image.
In other words, according to the magnification, the relative position of the partial region image that is superposed on the background image is slightly misaligned due to, for example, rounding error of the magnification. On the other hand, when the clipped partial region is filled with pixels having mean values of the pixels adjacent to the clipped region, and if the neighboring pixels are of various colors, the difference between the mean value and the value of the neighboring pixels will be greater.
Thus, if the display position of the partial region image is misaligned and moved from the original position due to, for example, a rounding error, pixels having a color of a mean value of the pixel values of the neighboring pixels that are used in the filling (i.e. false color) are displayed, and the pixels appear as a framing boundary streak of the partial region.
Further, the occurrence of this phenomenon is not limited to when the image is displayed on a display and a similar phenomenon occurs when the image is printed by a printer. Such a noise may cause a deteriorated display image and printed image.
As described above, Japanese patent No. 3376129 discusses a technique by which a clipped region is filled using pixel values of the pixels immediately before the clipped region in the scanning order of each scanning line. After the method is executed, the pixel values of the pixels in the clipped region may be different for each scanning line.
For example, FIG. 3 illustrates a background image 300 and a boundary 301 of a clipped region. The scanning direction is horizontal as can be seen from a scanning direction 302. In this state, the clipped region is filled with pixel values of pixels 303, which are the values of the pixels immediately before the clipped region on the each scanning line. For example, if the pixel values of the pixels 303 are a, b, c, d, e, . . . , x, . . . , and n, then the pixels of each scanning line in the clipped region will be filled with each of the pixel values of the pixels 303 on the same scanning line.
If a user displays such a document file and moves the clipped region when the user edits the document, the region that is filled according to the filling processing and in the background image comes out. At this time, if the pixel values of the pixels 303 include various pixel values, horizontal streaks in the horizontal direction will be seen in the background image. Consequently, an unnatural image will be displayed. Further, the streaks may lower the image compression rate.